<?php

class View extends Controller {

	function View() {
		parent::Controller();
		
		// loading model, assigning alias, forcing DB connect
		$this->load->model('Tagging_model', 'Tagging', TRUE);
		$this->load->model('Feeding_model', 'Feeding', TRUE);
		
		// helpers
		$this->load->helper('url');
	}
	
	/*
		BASIC TAG FUNCTIONS
	*/
	function index() {

		// for testing::
		// $this->root_tags();
	}
	
	function root_tags() {
		
		$data['title'] = "Get Root Tags";
		$data['heading'] = "Displaying All Root Tags";

		$data['query'] = $this->Tagging->get_root_tags();

		$this->load->view('view/root_tags_view', $data);
	}
	
	function root_tag() {
		$data['title'] = "Get Root Tag";
		$data['heading'] = "Displaying a Root Tag";
		
		$id = $this->uri->segment(3);
		
		$data['query'] = $this->Tagging->get_root_tag($id);

		$this->load->view('view/root_tag_view', $data);
	}
	
	function tags() {
		
		$data['title'] = "Get Tags";
		$data['heading'] = "Displaying All Tags";

		$data['query'] = $this->Tagging->get_tags();

		$this->load->view('view/tags_view', $data);
	}
	
	function related_tags() {
		
		$data['title'] = "Get Related Tags";
		$data['heading'] = "Displaying All Related Tags";

		$data['query'] = $this->Tagging->get_related_tags();

		$this->load->view('view/related_tags_view', $data);
	}
	
	/*
		BASIC FEED FUNCTIONS
	*/
	function feeds() {
		
		$data['title'] = "Get Feeds";
		$data['heading'] = "Displaying All Feeds";

		$data['query'] = $this->Feeding->get_feeds();

		$this->load->view('view/feeds_view', $data);
	}
	
	function feed_tags() {
		
		$data['title'] = "Get Feed Tags";
		$data['heading'] = "Displaying All Feed Tags";

		$data['query'] = $this->Feeding->get_feed_tags();

		$this->load->view('view/feed_tags_view', $data);
	}
}
?>